<?php
/* Smarty version 3.1.38, created on 2021-01-17 19:34:42
  from 'D:\phpstudy\phpstudy_pro\WWW\ggw\extend\smartybuilder\libs\Templates\table.html' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.38',
  'unifunc' => 'content_600420d29d2dd0_86195530',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '74b77863c4e58ec28ecf3a884f08f69e82b81892' => 
    array (
      0 => 'D:\\phpstudy\\phpstudy_pro\\WWW\\ggw\\extend\\smartybuilder\\libs\\Templates\\table.html',
      1 => 1610883278,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_600420d29d2dd0_86195530 (Smarty_Internal_Template $_smarty_tpl) {
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>menu</title>
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/css/public.css" media="all">
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/css/layuimini.css?v=2.0.4.2" media="all">
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/css/themes/default.css" media="all">
    <link rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <?php echo '<script'; ?>
 src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"><?php echo '</script'; ?>
>
    <?php echo '<script'; ?>
 src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"><?php echo '</script'; ?>
>
    <style>
        .layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {
            height: 34px;
            line-height: 34px;
            padding: 0 8px;
        }
        /*.layui-table-cell{*/
        /*display:table-cell;*/
        /*vertical-align: middle;*/
        /*}*/
        able{table-layout: fixed;}
        td{word-break: break-all; word-wrap:break-word;}
        .layui-fluid {
            height:auto;
        }
        .layui-table-cell  {
            height:auto;
            overflow:visible;
            text-overflow:inherit;
            white-space:pre-line;
        }
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="" id="table_form">

                    <div class="layui-form-item">
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['search']->value, 'value');
$_smarty_tpl->tpl_vars['value']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['value']->value) {
$_smarty_tpl->tpl_vars['value']->do_else = false;
?>
                            <?php if ($_smarty_tpl->tpl_vars['value']->value['type'] == 'input') {?>
                                        <div class="layui-inline">
                                    <label class="layui-form-label"><?php echo $_smarty_tpl->tpl_vars['value']->value['desc'];?>
</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="<?php echo $_smarty_tpl->tpl_vars['value']->value['name'];?>
" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            <?php } elseif ($_smarty_tpl->tpl_vars['value']->value['type'] == 'time') {?>
                        <div class="layui-inline">
                            <label class="layui-form-label"><?php echo $_smarty_tpl->tpl_vars['value']->value['desc'];?>
</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input date" name="<?php echo $_smarty_tpl->tpl_vars['value']->value['name'];?>
[start]">

                            </div>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input date" name="<?php echo $_smarty_tpl->tpl_vars['value']->value['name'];?>
[end]">

                            </div>
                        </div>
                        <?php } elseif ($_smarty_tpl->tpl_vars['value']->value['type'] == 'select') {?>
                        <div class="layui-inline">
                            <label class="layui-form-label"><?php echo $_smarty_tpl->tpl_vars['value']->value['desc'];?>
</label>
                            <div class="layui-input-inline">
                                <select name="<?php echo $_smarty_tpl->tpl_vars['value']->value['name'];?>
" class="layui-select" lay-search>
                                    <option value="">请选择</option>
                                    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['value']->value['option'], 'vs');
$_smarty_tpl->tpl_vars['vs']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['vs']->value) {
$_smarty_tpl->tpl_vars['vs']->do_else = false;
?>
                                        <?php if ($_smarty_tpl->tpl_vars['value']->value['hierarchy'] == 1) {?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['vs']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['vs']->value;?>
</option>
                                        <?php } else { ?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['vs']->value[$_smarty_tpl->tpl_vars['value']->value['select_value']['id']];?>
"><?php echo $_smarty_tpl->tpl_vars['vs']->value[$_smarty_tpl->tpl_vars['value']->value['select_value']['show']];?>
</option>
                                        <?php }?>
                                    <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                                </select>
                            </div>
                        </div>
                            <?php }?>
                        <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>

                        <div class="layui-inline">
                                <?php if (count($_smarty_tpl->tpl_vars['search']->value)) {?>
                            <button type="button" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                                <?php }?>
                            <button type="button" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btns"><i class="layui-icon"></i>刷新</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <?php echo '<script'; ?>
 type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['headtool']->value, 'v');
$_smarty_tpl->tpl_vars['v']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->do_else = false;
?>
                <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" style="<?php echo $_smarty_tpl->tpl_vars['v']->value['style'];?>
" data-action="<?php echo $_smarty_tpl->tpl_vars['v']->value['action'];?>
" data-type="<?php echo $_smarty_tpl->tpl_vars['v']->value['type'];?>
" lay-event="as"> <?php echo $_smarty_tpl->tpl_vars['v']->value['desc'];?>
 </button>
                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                <!--<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>-->
                <!--<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 全部删除 </button>-->
            </div>
        <?php echo '</script'; ?>
>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

        <?php echo '<script'; ?>
 type="text/html" id="currentTableBar">
            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['linebutton']->value, 'value');
$_smarty_tpl->tpl_vars['value']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['value']->value) {
$_smarty_tpl->tpl_vars['value']->do_else = false;
?>
            <a class="layui-btn layui-btn-xs data-count-delete" style="<?php echo $_smarty_tpl->tpl_vars['value']->value['style'];?>
" lay-event="abs" data-type="<?php echo $_smarty_tpl->tpl_vars['value']->value['type'];?>
" data-action="<?php echo $_smarty_tpl->tpl_vars['value']->value['action'];?>
" data-desc="<?php echo $_smarty_tpl->tpl_vars['value']->value['desc'];?>
"><?php echo $_smarty_tpl->tpl_vars['value']->value['desc'];?>
</a>
            <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
        <?php echo '</script'; ?>
>
    </div>
</div>
</body>
<?php echo '<script'; ?>
 src="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/lib/layui-v2.5.5/layui.js" charset="utf-8"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 src="<?php echo $_smarty_tpl->tpl_vars['path']->value;?>
/js/lay-config.js?v=1.0.4" charset="utf-8"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
>
    layui.use(['form', 'table','laydate'], function () {
        var $ = layui.jquery,
            form = layui.form,
            laydate = layui.laydate,
            table = layui.table;

        table.render({
            elem: '#currentTableId',url: '<?php echo $_smarty_tpl->tpl_vars['action']->value;?>
',
            toolbar: '#toolbarDemo',
            <?php if ($_smarty_tpl->tpl_vars['page']->value['type']) {?>
            page: true,
            <?php } else { ?>
            page: false,
            <?php }?>
            limits: [
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['page']->value['limits'], 'limis');
$_smarty_tpl->tpl_vars['limis']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['limis']->value) {
$_smarty_tpl->tpl_vars['limis']->do_else = false;
?>
            <?php echo $_smarty_tpl->tpl_vars['limis']->value;?>
,
                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
            ],
            limit: <?php echo $_smarty_tpl->tpl_vars['page']->value['limit'];?>
,
                    <?php if (count($_smarty_tpl->tpl_vars['total']->value)) {?>
                    totalRow:true,
                        <?php }?>
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {type: "checkbox", width: 50,align: 'center',},
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['columns']->value, 'val', false, 'k');
$_smarty_tpl->tpl_vars['val']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['k']->value => $_smarty_tpl->tpl_vars['val']->value) {
$_smarty_tpl->tpl_vars['val']->do_else = false;
?>
                    <?php if ($_smarty_tpl->tpl_vars['k']->value == 0) {?>
                        <?php if (count($_smarty_tpl->tpl_vars['total']->value)) {?>
                    {field: '<?php echo $_smarty_tpl->tpl_vars['val']->value['name'];?>
', title: '<?php echo $_smarty_tpl->tpl_vars['val']->value['desc'];?>
',align: 'center', sort: true,totalRowText:'合计'},
                        <?php } else { ?>
                    {field: '<?php echo $_smarty_tpl->tpl_vars['val']->value['name'];?>
',  title: '<?php echo $_smarty_tpl->tpl_vars['val']->value['desc'];?>
',align: 'center', sort: true},
                        <?php }?>
                    <?php } else { ?>
                            <?php if (in_array($_smarty_tpl->tpl_vars['val']->value['name'],$_smarty_tpl->tpl_vars['total']->value)) {?>
                            {field: '<?php echo $_smarty_tpl->tpl_vars['val']->value['name'];?>
', title: '<?php echo $_smarty_tpl->tpl_vars['val']->value['desc'];?>
',sort:true,align: 'center',totalRow: true},
                            <?php } else { ?>
                            {field: '<?php echo $_smarty_tpl->tpl_vars['val']->value['name'];?>
', title: '<?php echo $_smarty_tpl->tpl_vars['val']->value['desc'];?>
',sort:true,align: 'center'},
                            <?php }?>
                    <?php }?>
                    <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                        {title: '操作', minWidth: 150,maxWidth:200, toolbar: '#currentTableBar', align: "center"}
            ]],
            done:function () {
                // layer.msg('加载完成')
            }
            // skin: 'line'
        });
        function table_reload(){
            var t = $('#table_form').serializeArray();
            var page = $('.layui-laypage-curr').children('em').text()
            console.log(t)
            <?php if ($_smarty_tpl->tpl_vars['page']->value['type']) {?>
            table.reload('currentTableId', {page: {
                    curr: page
                }
            }, 'data');
            <?php } else { ?>
            table.reload('currentTableId', {page: false
            }, 'data');
            <?php }?>
        }
        $('.date').each(function() {
            laydate.render({
                elem: this,
                type:"datetime",
//            value:new Date(),
                istime: true,
            });
        })

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            // layer.alert(result, {
            //     title: '最终的搜索信息'
            // });
            var tiaojian = {};
            $.each(data.field,function (i,v) {
                tiaojian[i] = v;
            })
            console.log(tiaojian)
            <?php if ($_smarty_tpl->tpl_vars['page']->value['type']) {?>
            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: tiaojian
            }, 'data');
            <?php } else { ?>
            table.reload('currentTableId', {
                page: false
                , where: tiaojian
            }, 'data');
            <?php }?>
            return false;
        });
        form.on('submit(data-search-btns)', function (data) {
            location.reload();

            return false;
        });
        /**
         * 监听开关
         * */
        form.on('switch(sexDemo)',function (data) {
            console.log(data);
            var status = data.elem.checked;
            // console.log(status);
            var id = data.value;
            var field = $(this).attr('field');
            $.post('{:url("command.fileadmin/change")}',{id:id,field:field},function (res) {
                if(res.code==200){
                    layui.layer.msg(res.msg);
                }else{
                    layui.layer.msg(res.msg);
                    // table_reload();
                    data.elem.checked = !status;
                }
            })
        })

        /**
         * toolbar监听事件
         */
        table.on('toolbar(currentTableFilter)', function (obj) {
            console.log(obj)
            console.log($(this))
            var type = $(this).context.dataset.type;
            var action = $(this).context.dataset.action;
            console.log(type)
            console.log(action)
            if(type=='button'){
                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                var data_id = new Array();
                $.each(data,function (i,v) {
                    data_id.push(v.id);
                })
                layer.confirm('真的执行这个操作吗？', function (index) {
                    // console.log(data);
                    var id = data_id;
                    $.post(action,{id:id},function (res) {
                        console.log(res);
                        if(res.code==200){
                            layer.msg(res.msg);
                        }else{
                            layer.msg(res.msg);
                        }
                        table_reload();
                    })

                });
            }else if(type=='a'){
                var index = layer.open({
                    title: '添加文件管理',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['90%', '90%'],content: action,end:function () {
                        //执行搜索重载
                        table_reload();
                    }
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
            }
        });

        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });

        table.on('tool(currentTableFilter)', function (obj) {
            console.log(obj)
            console.log($(this))
            var type = $(this).context.dataset.type;
            var action = $(this).context.dataset.action;
            var desc = $(this).context.dataset.desc;
            var data = obj.data;
            if(obj.event=='abs'){
                if(type=='button'){
                    layer.confirm('真的执行这个操作吗？', function (index) {
                        // console.log(data);
                        var id = data.id;
                        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
                        $.post(action,{id:id},function (res) {
                            layer.close(index)
                            console.log(res);
                            if(res.code==200){
                                layer.msg(res.msg);
                                table_reload();
                                // obj.del();
                                // layer.close(index);
                            }else{
                                layer.msg(res.msg);
                            }
                        })
                        // obj.del();
                        // layer.close(index);
                    });
                }else if(type=='a'){
                    var id = data.id;
                    id = 'id='+id;
                    if(action.indexOf('?')==-1){
                        action = action+'?'+id;
                    }else{
                        action = action+'&'+id;
                    }
                    var index = layer.open({
                        title: desc,
                        type: 2,
                        shade: 0.2,
                        maxmin:true,
                        shadeClose: true,
                        area: ['90%', '90%'],content: action,end:function(){table_reload();},});
                    $(window).on("resize", function () {
                        layer.full(index);
                    });
                    return false;
                }
            }
        });

    });
<?php echo '</script'; ?>
>
</html><?php }
}
